public class Solution485 {
    public int findMaxConsecutiveOnes(int[] nums) {
        int ans=0;
        int cur=0;
        for (int i=0;i<nums.length;i++){
            if (nums[i]==1){
                cur++;
            }else{
                ans=Math.max(ans,cur);
                cur=0;
            }
        }
        ans=Math.max(ans,cur);
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution485().findMaxConsecutiveOnes(new int[]{1,1,0,1,1,1}));
    }
}
